Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Oct 23, 2025

Closes phpstan/phpstan#13713

Solves phpstan/phpstan#6305 (comment)

Partially revert #1044 cc @herndlm

I don't think we can resolve the original request of phpstan/phpstan#6305 (comment) without introducing lot of false positive, like shown by this PR.

@VincentLanglet VincentLanglet marked this pull request as ready for review October 24, 2025 17:33
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@VincentLanglet
Copy link
Contributor Author

This issue was more complicated than expected... I'm not against your opinion/review @staabm :)

@VincentLanglet VincentLanglet requested a review from staabm October 29, 2025 21:49
namespace IsSubclassOf;

function (Bar $a, Bar $b, Bar $c, Bar $d) {
if (is_subclass_of($a, Bar::class)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have a test somewhere for use of is_subclass_of with a final-class ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@VincentLanglet VincentLanglet requested a review from staabm October 31, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PHPStan incorrectly narrows type of object after an instanceof check

3 participants